import { post } from '@/request/http'
import store from '@/store'

// 获取企业费收管理的下拉框数据
export const getSelectDown = (data) =>
  post(
    '/FTKJWLHYPT/base/getRefCodesByType',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            rvDomain: data.rvDomain,
            rvTerId: store.state.user.FLT_UUID_DX_H,
          }
        }
      }
    }
  )

// 企业费用管理 费目列表查询
export const getFeeData = () =>
  post(
    '/FTKJWLHYPT/SysResultsFees/getStandardFeeLists',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chiFltId: store.state.user.FLT_UUID_DX_H,
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: ''
        },
        PageSizes: {
          FTKJWLHYPT: ''
        }
      }
    }
  )

// 企业费用管理 新增费目
export const addFeeService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/createStandardFee',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chiFltId: store.state.user.FLT_UUID_DX_H,
            chiCode: data.feeCode,
            chiCnname: data.feeChName,
            chiUnit: data.priceUnit,
            chiBpsign: data.feeStatus,
            chiSeqno: data.feeOrder,
            chiInsertuser: store.state.user.USR_CODE_DX_H,
            chiInsertdt: '',
            chiLstupduser: '',
            chiLstupddt: '',
            chiIsvalid: data.validStatus,
            chiRemark: data.desc,
            chiEnname: data.feeEnName,
            chiPayobject: data.feeObj,
            chiOrfee: data.feeElse,
            chiDptId: store.state.user.DPTID_DX_H,
            chiDepId: store.state.user.DPTID_DX_H,
            chiCodeName: '',
          }
        },
      }
    }
  )
// 企业费用管理 编辑费目
export const editFeeService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/editStandardFee',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chiItemid: data.chiItemid,
            chiFltId: store.state.user.FLT_UUID_DX_H,
            chiCode: data.feeCode,
            chiCnname: data.feeChName,
            chiUnit: data.priceUnit,
            chiBpsign: data.feeStatus,
            chiSeqno: data.feeOrder,
            chiInsertuser: store.state.user.USR_CODE_DX_H,
            chiInsertdt: '',
            chiLstupduser: store.state.user.USR_CODE_DX_H,
            chiLstupddt: '',
            chiIsvalid: data.validStatus,
            chiRemark: data.desc,
            chiEnname: data.feeEnName,
            chiPayobject: data.feeObj,
            chiOrfee: data.feeElse,
            chiDptId: store.state.user.DPTID_DX_H,
            chiDepId: store.state.user.DPTID_DX_H,
            chiCodeName: '',
          }
        },
      }
    }
  )
// 企业费用管理 删除费目
export const delFeeService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/deleteStandardFee',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chiItemid: data.chiItemid,
          }
        },
      }
    }
  )


// 企业费用管理 费目细项查询
export const feeDetailSearchService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/getTmsDetailsLists',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chdChiItemid: data.chiItemid,
            chdFltId: store.state.user.FLT_UUID_DX_H,
            chdCnname: data.feeDetailName
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: data.PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT: data.PageSizes
        }
      }
    }
  )


// 企业费用管理 选择费目属性查询
export const selectFeeAttrService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/GetSysChargePropertyList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            cprDptId: store.state.user.DPTID_DX_H,
            fltId: store.state.user.FLT_UUID_DX_H
          }
        },
        Orderbys: {},
        PageIndexs: {
          FTKJWLHYPT: data.PageIndexs
        },
        PageSizes: {
          FTKJWLHYPT: data.PageSizes
        }
      }
    }
  )

// 企业费用管理 选择费目属性  区域中心下拉框
export const centerSelect = () =>
  post(
    '/FTKJWLHYPT/platform/getDepartmentName',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            dptFltId: store.state.user.FLT_UUID_DX_H,
          }
        },
      }
    }
  )


// 企业费用管理 新增费目细项
export const feeDetailAddService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/createTmsDetails',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chdChiItemid: data.chdChiItemid,
            chdCprId: data.chdCprId,
            chdFltId: store.state.user.FLT_UUID_DX_H,
            chdCnname: data.chName,
            chdEnname: data.enName,
            chdUnit: data.priceUnit,
            chdPrintname: data.printName,
            chdOrder: data.feeOrderNum,
            chdPermitfg: data.updataPrice,
            chdInsertuser: store.state.user.USR_CODE_DX_H,
            chdLstupduser: store.state.user.USR_CODE_DX_H,
            chdRemark: data.desc,
            chdApply: data.isFeeUse,
            chdDptId: store.state.user.DPTID_DX_H,
            chdDepId: store.state.user.DPTID_DX_H,
          }
        },
      }
    }
  )

// 企业费用管理 编辑费目细项
export const feeDetailEditService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/editTmsDetails',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chdId: data.chdId,
            chdChiItemid: data.chdChiItemid,
            chdCprId: data.chdCprId,
            chdFltId: store.state.user.FLT_UUID_DX_H,
            chdCnname: data.chName,
            chdEnname: data.enName,
            chdUnit: data.priceUnit,
            chdPrintname: data.printName,
            chdOrder: data.feeOrderNum,
            chdPermitfg: data.updataPrice,
            chdInsertuser: store.state.user.USR_CODE_DX_H,
            chdLstupduser: store.state.user.USR_CODE_DX_H,
            chdRemark: data.desc,
            chdApply: data.isFeeUse,
            chdDptId: store.state.user.DPTID_DX_H,
            chdDepId: store.state.user.DPTID_DX_H,
          }
        },
      }
    }
  )

// 企业费用管理 删除费目细项
export const feeDetailDelService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/deleteTmsDetails',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chdId: data.chdId
          }
        },
      }
    }
  )

// 企业费用管理 费率查询
export const rateSearchService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/getTmsPriceList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chpChdId: data.chpChdId,
            chpFltId: store.state.user.FLT_UUID_DX_H,
          }
        },
      }
    }
  )

// 企业费用管理 费率新增
export const rateAddService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/createTmsPrice',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chpFltId: store.state.user.FLT_UUID_DX_H,
            chpPrice: data.ratePrice,
            chpCurrency: data.rateMoneyCate,
            chpStdt: data.startTime,
            chpEddt: data.endTime,
            chpRoundfg: data.rounded,
            chpInsertuser: store.state.user.USR_CODE_DX_H,
            chpLstupduser: store.state.user.USR_CODE_DX_H,
            chpIsvalid: data.userful,
            chpRemark: data.note,
            chpChdId: data.chpChdId,
            chpDptId: store.state.user.DPTID_DX_H,
            chpDepId: store.state.user.DPTID_DX_H,
          }
        },
      }
    }
  )

// 企业费用管理 费率编辑
export const rateEditService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/editTmsPrice',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chpId: data.chpId,
            chpFltId: store.state.user.FLT_UUID_DX_H,
            chpPrice: data.ratePrice,
            chpCurrency: data.rateMoneyCate,
            chpStdt: data.startTime,
            chpEddt: data.endTime,
            chpRoundfg: data.rounded,
            chpInsertuser: store.state.user.USR_CODE_DX_H,
            chpLstupduser: store.state.user.USR_CODE_DX_H,
            chpIsvalid: data.userful,
            chpRemark: data.note,
            chpChdId: data.chpChdId,
            chpDptId: store.state.user.DPTID_DX_H,
            chpDepId: store.state.user.DPTID_DX_H,
          }
        },
      }
    }
  )

// 企业费用管理 费率删除
export const rateDelService = (data) =>
  post(
    '/FTKJWLHYPT/SysResultsFees/deleteTmsPrice',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            chpId: data.chpId,
          }
        },
      }
    }
  )

